import request from '/@/utils/request';

/**
 *
 * 用户api接口集合
 * @method
 */
export function configApi() {
    return {
        getTableData: (data: object) => {
            return request({
                url: 'sys/config/list',
                method: 'post',
                data,
            });
        },
        addRecord: (data: object) => {
            return request({
                url: 'sys/config/',
                method: 'post',
                data: data,
            });
        },
        updateRecord: (data: object) => {
            return request({
                url: 'sys/config/',
                method: 'put',
                data: data,
            });
        },
        delRecord: (data: object) => {
            return request({
                url: 'sys/config/',
                method: 'delete',
                data: data,
            });
        },
        findAll: () => {
            return request({
                url: '/sys/config/all',
                method: 'post'
            })
        },
        exportRecord: (data: object) => {
            return request({
                url: 'sys/config/export',
                method: 'download',
                data: data
            });
        },
        // 根据参数键名查询参数值
        getConfigKey: (configKey: any) => {
            return request({
                url: 'sys/config/configKey/' + configKey,
                method: 'get'
            })
        },
        updateConfigByKey: (key: any, value: any) => {
            return request({
                url: 'sys/config/updateByKey',
                method: 'put',
                data: {
                    configKey: key,
                    configValue: value
                }
            })
        }
    };
}
